JavaScript as an Embedded DSL

نویسندگان

  • Grzegorz Kossakowski
  • Nada Amin
  • Tiark Rompf
  • Martin Odersky
چکیده

Developing rich web applications requires mastering different environments on the client and server sides. While there is considerable choice on the server-side, the client-side is tied to JavaScript, which poses substantial software engineering challenges, such as moving or sharing pieces of code between the environments. We embed JavaScript as a DSL in Scala, using Lightweight Modular Staging. DSL code can be compiled to JavaScript or executed as part of the server application. We use features of the host language to make client-side programming safer and more convenient. We use gradual typing to interface typed DSL programs with existing JavaScript APIs. We exploit a selective CPS transform already available in the host language to provide a compelling abstraction over asynchronous callback-driven programming in our DSL.

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Just-in-time Acceleration of JavaScript

JavaScript has seen tremendous growth in popularity driven by increasingly interactive web sites and sophisticated web interfaces. However, the performance of JavaScript continues to be a hurdle in using it for tasks that are computationally intensive, such as gaming, simulations, and visualization. JavaScript has also been slow to exploit the available parallelism on modern computers. Specific...

متن کامل

PULP Scription: A DSL for Mobile HTML5 Game Applications

As applications and especially games are moving to the web and mobile environments, different tools are needed to design these applications and their behavior. HTML5 in combination with JavaScript is a promising basis for such applications on a wide range of platforms. Content producers and designers often lack the tools for such developments, or the expertise to operate existing, but too compl...

متن کامل

Inferring Types for Asynchronous Arrows in JavaScript

Asynchronous programming with callbacks in JavaScript leads to code that is difficult to understand and maintain. Arrows, a generalization of monads, are an elegant solution to asynchronous program composition. Unfortunately, improper arrow composition can cause mysterious failures with subtle sources. We present an arrows-based DSL in JavaScript which encodes semantics similar to ES6 Promises ...

متن کامل

J Is for JavaScript: A Direct-Style Correspondence between Algol-Like Languages and JavaScript Using First-Class Continuations

It is a time-honored fashion to implement a domain-specific language (DSL) by translation to a general-purpose language. Such an implementation is more portable, but an unidiomatic translation jeopardizes performance because, in practice, language implementations favor the common cases. This tension arises especially when the domain calls for complex control structures. We illustrate this tensi...

متن کامل

Uniting Language Embeddings for Fast and Friendly DSLs

The holy grail for a domain-specific language (DSL) is to be friendly and fast. A DSL should be friendly in the sense that it is easy to use by DSL end-users, and easy to develop by DSL authors. DSLs can be developed as entirely new compilers and ecosystems, which requires tremendous effort and often requires DSL authors to reinvent the wheel. Or, DSLs can be developed as libraries embedded in ...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2012